package com.young.common.client.monitor.web;

import com.young.common.core.monit.NodeStatus;
import com.young.common.core.monit.NodeStatusFactory;
import com.young.common.util.Result;
import com.young.interfaces.log.annotation.Log;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * jvm监控
 *
 * @author wangjy
 * @date 2021/11/27 11:04:10
 */
@Controller
@RequestMapping(value = "/monitor/client", method = {RequestMethod.GET, RequestMethod.POST})
public class MonitorClientController {

    /**
     * 查询服务器运行状况
     * @return
     */
    @Log("查询服务器运行状况")
    @RequestMapping("/serverStatus")
    @ResponseBody
    public Object serverStatus(){
        NodeStatus nodeStatus = NodeStatusFactory.getLocalNodeStatus();
        return Result.buildSuccess(nodeStatus);
    }
}
